<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE HTML>

<html>
<head>
<jsp:include page="../defaults/tagHeadContent.jsp" />
</head>
<body>
	<jsp:include page="../defaults/header.jsp" />
	<div id="wrapper">
		<div id="content">
			<jsp:include page="../defaults/sidebar.jsp" />

			<div id="list">
				<table>
					<thead>
						<tr>
							<th>ID</th>
							<th>Nome</th>
							<th>Descrição</th>
							<th>Usuários responsáveis</th>
							<th>Formulário</th>
							<th>Entrega</th>
							<th>Submissão</th>
							<th>Download</th>
							<th>Editar</th>
							<c:if test="${webUser.administrator}">
								<th>Remover</th>
							</c:if>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${sfList}" var="sf">
							<tr>
								<td>${sf.relatedTask.id}</td>
								<td>${sf.relatedTask.name}</td>
								<td>${sf.relatedTask.description}</td>
								<td>
									<form action="<c:url value="/task/usersInCharge"/>"
										method="GET">
										<input type="hidden" name="task.id"
											value="${sf.relatedTask.id }" />
										<button type="submit">Responsáveis</button>
									</form></td>
								<td>${sf.relatedTask.evaluationForm.id}</td>
								<td>${sf.relatedTask.duedate}</td>
								<td>
									<form action="<c:url value="/submittedFile/upload"/>"
										enctype="multipart/form-data" method="POST">
										<input type="hidden" name="task.id"
											value="${sf.relatedTask.id }"> <input type="hidden"
											name="sf.task" value="${sf.relatedTask }"> <input
											type="file" name="uf" />
										<button type="submit">Enviar</button>
									</form></td>
								<td>
									<form action="<c:url value="/submittedFile/download"/>"
										enctype="multipart/form-data" method="POST">
										<input type="hidden" name="sf" value="${sf}">
										<button type="submit">Download</button>
									</form>
								</td>

								<td>
									<form action="<c:url value="/task/info"/>" method="GET">
										<input type="hidden" name="task.id"
											value="${sf.relatedTask.id }" />
										<button type="submit">Editar</button>
									</form>
								</td>
								<c:if test="${webUser.administrator}">
									<td>
										<form action="<c:url value="/task/delete"/>" method="POST">
											<input type="hidden" name="task.id"
												value="${sf.relatedTask.id }" />
											<button type="submit" name="_method" value="DELETE">Remover</button>
										</form>
									</td>
								</c:if>
							</tr>
						</c:forEach>
					</tbody>
				</table>


			</div>

		</div>
		<div style="clear: both;">&nbsp;</div>
	</div>

	<jsp:include page="../defaults/footer.jsp" />
</body>
</html>
